# -*- coding: utf-8 -*-
class Payable < ActiveRecord::Base
  belongs_to :employee        #付款人员
  belongs_to :purchase_order  #相关的采购订单
  belongs_to :vendor          #供应商
  belongs_to :auditor, :class_name => 'Employee', :foreign_key => 'auditor_id'

  scope :find_all, lambda { |conditionsStr,conditionsHash| { :conditions => [conditionsStr,conditionsHash],:include=>[:vendor,:auditor,:employee,:purchase_order],:order=> "updated_at DESC" }}
  scope :paginate, lambda { |start,limit| { :offset => start.to_i,:limit => limit.to_i, }}
end
